package marlon.smsbatcheditor.model;

/**
 * 
 * @author marlonyao<yaolei135@gmail.com>
 */
public class RuleCondition {
	public enum Term {
		ALL,
		ADDRESS,
		BODY,
	}
	public interface Predict { }
	
	public enum Read implements Predict {
		ALL,
		UNREAD,
		READ,
	}
	
	public enum Contains implements Predict {
		CONTAINS,
		STARTS_WITH,
		ENDS_WITH,
		EQUALS,
	}
	
	private Term term;
	private Predict predict;
	private String value;
	
	private static RuleCondition INSTANCE_ALL = createReadCond(Read.ALL);
	private static RuleCondition INSTANCE_READ = createReadCond(Read.READ);
	private static RuleCondition INSTANCE_UNREAD = createReadCond(Read.UNREAD);
	
	public RuleCondition(Term term, Predict predict, String value) {
		this.term = term;
		this.predict = predict;
		this.value = value;
	}
	
	private static RuleCondition createReadCond(Read read) {
		return new RuleCondition(Term.ALL, read, null);
	}
	
	public static RuleCondition all() { return INSTANCE_ALL; }
	public static RuleCondition read() { return INSTANCE_READ; }
	public static RuleCondition unread() { return INSTANCE_UNREAD; }
	
	public Term getTerm() {
		return term;
	}
	
	public String getValue() {
		return value;
	}
	
	public Predict getPredict() {
		return predict;
	}
}
